﻿@model LeadMaster.Models.LeadStatus

@using (Html.BeginForm("ChangeLeadReason", "Outsourcer", FormMethod.Post, new { @id = "formChangeReason" }))
{
@Html.ValidationSummary(true)
<fieldset>
<legend>Change Status Reason Of This Lead</legend>
@Html.HiddenFor(m => m.LeadStatusID)
@Html.HiddenFor(m => m.BlockID)
@Html.HiddenFor(m => m.LeadFlagsID)
@Html.HiddenFor(m => m.LeadID)
@Html.HiddenFor(m => m.CallCentreID)
@Html.HiddenFor(m => m.LeadDate)
@Html.HiddenFor(m => m.PurchaseOrderID)
@Html.HiddenFor(m => m.VoxFile)

<div>
<table class="listtable contactstable" cellspacing="0" cellpadding="0" style="width: 500px;" id="enquirylist">
    <tr>
    <th style="text-align: left"><label>Reason</label></th>
    <td style="border-style: none">
    
    <select id="LeadReasonsID" name="LeadReasonsID">
    <option>Please select a valid Reason...</option>
    @foreach (var item in ViewBag.LeadReasons)
    {
        <option value="@(item.LeadReasonsID)" data-inforequired="@(item.InfoRequired)" data-infoprompt="@(item.InfoPrompt)" id="option@(item.LeadReasonsID)">@item.Description</option>
    }
    </select>
    </td>
    </tr>
    <tr>
    <th style="text-align: left">
    <label id="infoheading"></label>
    </th>
    <td style="border-style: none" id="cellinfo">@Html.TextAreaFor(m => m.Notes, new { @class="notes"})
    </td>
    </tr>
</table>
</div>
</fieldset>
}



<script type="text/javascript">
    $(document).ready(function () {

        $('#Notes').hide();

        $('#LeadReasonsID').change(function () {
            var optionSelected = $(this).val();
            if ($("#option" + optionSelected).data("inforequired") == "True") {
                $('#infoheading').text($("#option" + optionSelected).data("infoprompt"));
                $('#Notes').show();
                $('#infoheading').show();
            }
            else {
                $('#Notes').hide();
                $('#infoheading').hide();
            }
        });
    });
</script>
